package com.example.demo.enums;

import com.example.demo.model.Book;

public enum BookStatus {
    DELETED(0, "删除"),
    AVAILABLE(1, "可借阅"),
    FORBIDDEN(2, "不可借阅"),
    ;

    public static BookStatus getBookStatusByCode(Integer code){
        switch(code){
            case 0: return DELETED;
            case 1: return AVAILABLE;
            case 2:
            default:
                return FORBIDDEN;
        }
    }
    BookStatus(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    private Integer code;
    private String name;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
